// 复原ip地址
const str = "25525511135";
// const current = [];
let res = [];
const restoreIpAddress = (current, remainStr) => {
    if (current.length === 4 && current.join('') === str) {
        res.push(current.join('.'));
    }
    for (let i = 0; i < Math.min(3, remainStr.length); i++) {
        let tem = remainStr.substr(0, i + 1);
        if (tem < 256) {
            restoreIpAddress(current.concat(tem), remainStr.substr(i + 1));
        }
    }
    return res;
}
const res1 = restoreIpAddress([], str);
console.log(res1);
